{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 判断结构体【语法与java一致，但是写法上注意】"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* 条件语句没有（）也没有{}，还有条件结束：标记"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ok\n"
     ]
    }
   ],
   "source": [
    "temp=1212\n",
    "if temp >=12 :\n",
    "    print(\"ok\")\n",
    "else :\n",
    "    print(\"no\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* if  elif   else 这种结构【写法上注意】"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2\n"
     ]
    }
   ],
   "source": [
    "temp=23\n",
    "if temp >=0 and temp<=10 :\n",
    "    print(\"1\")\n",
    "elif temp>10 and temp<=30 :\n",
    "    print(\"2\")\n",
    "else :\n",
    "    print(\"3\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* 集合中使用 if判断"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "存在\n"
     ]
    }
   ],
   "source": [
    "temp=[1,2,3,4,5]\n",
    "if 2 in temp :\n",
    "    print(\"存在\")\n",
    "else:\n",
    "    print(\"不存在\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* 字典使用if"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "存在\n"
     ]
    }
   ],
   "source": [
    "temp={'guochao':123,'gcc':234}\n",
    "if 'guochao' in temp :\n",
    "    print('存在')\n",
    "else :\n",
    "    print(\"不存在\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
